<?php

session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}

$idemployee = $_GET["idemployee"];

$listreference = $_SESSION['listreference'];
$namereference = $_SESSION['namereference'];

$i = $_SESSION['slreference'];
$co = 0;
$k = 0;
for ($j = 0; $j < $i; $j++) {

    if ($listreference[$j] == $idemployee) {
        $j = $j + 1;
    }
    $ntempreference[$k] = $namereference[$j];
    $tempreference[$k] = $listreference[$j];
    $k = $k + 1;
}
$i = $i - 1;
$namereference = $ntempreference;
$listreference = $tempreference;

$_SESSION['listreference'] = $tempreference;
$_SESSION['namereference'] = $ntempreference;
$_SESSION['slreference'] = $i;

echo "<table border='1' class='table_th' style='height:22px;' cellspacing='0' width='100%'>
<tr style='background-color:#EEE;'>
<td colspan='2'>List Reference</td>

</tr>";
for ($j = 0; $j < $i; $j++) {


    echo "<tr >";
    echo "<td>" . $namereference[$j] . "</td>";
    echo "<td><a onclick='rmReference(" . $listreference[$j] . ")'><img src='images/del.png' /></a></td>";
    echo "</tr>";
}
echo "</table>";
?>